package com.bsit.obu.model.obu;

import java.util.ArrayList;
import java.util.List;

public enum BankType {

    GONGSHANG("64010101001", "中国工商银行"),
    JIANSHE("64010101002", "中国建设银行"),
    ZHONGGUO("64010101003", "中国银行"),
    NONGYE("64010101004", "中国农业银行"),
    JIAOTONG("64010101005", "中国交通银行"),
    YOUZHENG("64010101006", "中国邮政储蓄银行"),
    ZHAOSHANG("64010101007", "招商银行"),
    RUDONG("64010101008", "上海浦东发展银行"),
    ZHONGXIN("64010101009", "中信银行"),
    GUANGDA("64010101010", "中国光大银行"),
    HUAXIA("64010101011", "华夏银行"),
    MINSHENG("64010101012", "中国民生银行"),
    GUANGFA("64010101013", "广发银行"),
    XINGYE("64010101014", "兴业银行"),
    PINGAN("64010101015", "平安银行"),
    HENGFENG("64010101016", "恒丰银行"),
    ZEHSHANG("64010101017", "浙商银行"),
    BOHAN("64010101018", "渤海银行"),
    ZHIFUBAO("64010101101", "支付宝"),
    WEIXIN("64010101102", "微信"),
    YINLIAN("64010101103", "银联"),
    SHIZUISHAN("64010101301", "石嘴山");


    private String code;
    private String content;

    BankType(String code, String content) {
        this.code = code;
        this.content = content;
    }
    public static String getCode(String content){
        String code = "";
       BankType[] recordTypes =  BankType.values();
       for (int i = 0;i<recordTypes.length;i++){
           if(recordTypes[i].content.equals(content)){
               code =  recordTypes[i].code;
           }
       }
       return code;
    }
    public static List<String> getContents(){
        List<String> list = new ArrayList<>();
        BankType[] recordTypes =  BankType.values();
        for (int i = 0;i<recordTypes.length;i++){
            list.add(recordTypes[i].content);
        }
      return list;
    }

    public static String getContent(String code){
        String content = "";
        BankType[] cardTypes =  BankType.values();
        for (int i = 0;i<cardTypes.length;i++){
            if(cardTypes[i].code.equals(code) ){
                content =  cardTypes[i].content;
            }
        }
        return content;
    }

}
